package com.springapp.fed.config;

import com.restfb.DefaultFacebookClient;
import com.restfb.FacebookClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.social.facebook.api.Facebook;
import org.springframework.social.facebook.api.impl.FacebookTemplate;

/**
 * Created with IntelliJ IDEA.
 * User: WENKY
 * Date: 10/30/13
 * Time: 11:58 PM
 * To change this template use File | Settings | File Templates.
 */
@Configuration
@PropertySource({"classpath:/resources/authentication.properties"})
public class SocialConfig {
    @Autowired
    org.springframework.core.env.Environment environment;

    @Bean
    FacebookClient facebookClient(){
        FacebookClient facebookClient = new DefaultFacebookClient(environment.getProperty("facebook.accesstoken"));
         return facebookClient;
    }

    @Bean
    Facebook facebook(){
        Facebook facebook = new FacebookTemplate(environment.getProperty("facebook.accesstoken"));
        return facebook;
    }
}